package com.model.dao;
// default package
// Generated Feb 26, 2014 2:36:33 PM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 * RoleTable generated by hbm2java
 */
@Entity
@Table(name = "role_table", catalog = "shoppingcart_schema")
public class RoleTable implements java.io.Serializable {

	private int idroleTable;
	private String roleName;
	private String roleDescription;
	private String active;
	private Set<RolePermissionTable> rolePermissionTables = new HashSet<RolePermissionTable>(
			0);
	private Set<UserRoleTable> userRoleTables = new HashSet<UserRoleTable>(0);

	public RoleTable() {
	}

	public RoleTable(int idroleTable, String roleName) {
		this.idroleTable = idroleTable;
		this.roleName = roleName;
	}

	public RoleTable(int idroleTable, String roleName, String roleDescription,
			String active, Set<RolePermissionTable> rolePermissionTables,
			Set<UserRoleTable> userRoleTables) {
		this.idroleTable = idroleTable;
		this.roleName = roleName;
		this.roleDescription = roleDescription;
		this.active = active;
		this.rolePermissionTables = rolePermissionTables;
		this.userRoleTables = userRoleTables;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "idrole_table", unique = true, nullable = false)
	public int getIdroleTable() {
		return this.idroleTable;
	}

	public void setIdroleTable(int idroleTable) {
		this.idroleTable = idroleTable;
	}

	@Column(name = "role_name", nullable = false, length = 45)
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@Column(name = "role_description", length = 45)
	public String getRoleDescription() {
		return this.roleDescription;
	}

	public void setRoleDescription(String roleDescription) {
		this.roleDescription = roleDescription;
	}

	@Column(name = "active", length = 1)
	public String getActive() {
		return this.active;
	}

	public void setActive(String active) {
		this.active = active;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "roleTable")
	@Cascade({CascadeType.SAVE_UPDATE,CascadeType.ALL,CascadeType.DELETE_ORPHAN})
	public Set<RolePermissionTable> getRolePermissionTables() {
		return this.rolePermissionTables;
	}

	public void setRolePermissionTables(
			Set<RolePermissionTable> rolePermissionTables) {
		this.rolePermissionTables = rolePermissionTables;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "roleTable")
	public Set<UserRoleTable> getUserRoleTables() {
		return this.userRoleTables;
	}

	public void setUserRoleTables(Set<UserRoleTable> userRoleTables) {
		this.userRoleTables = userRoleTables;
	}

}
